***Last Updated: 11/04/2021 Stata17
/*==========================================*
Paper:			Trade-offs? The Impact of WTO Accession on Intimate Partner Violence in Cambodia

Purpose:        Generate tables using the 1998 and 2008 Population Census Data of Cambodia

To re-run our analysis, please install a folder "Cambodia". There should be 4 subfolders in order for do-files to run:

"created"
"do files"
"graphs"
"output"

/***********************************/
/* INDEX:                          */
/* TABLE 1 Panel A                 */
/* TABLE 2                         */
/* APPENDIX TABLE A7               */
/* APPENDIX TABLE A8               */
/* APPENDIX TABLE A11              */
/* APPENDIX TABLE A14              */
/* APPENDIX TABLE A17              */
/***********************************/

*==========================================*/

clear
clear matrix
clear mata
set more off 
set matsize 11000
set maxvar 32000
cap log close

global dir="XXX\Cambodia"
cd "$dir"

log using "Log_tables_using_Census.log", replace

use "created/census_for_analysis.dta", clear

*Define set of control variables for analysis
global xvar1="age lessprimary primary secondary university schooling rural top5_tariff"
global fe0="i.district i.year"
global fe1="i.district i.year employed_diff_post "
global fe2="i.district i.year unemployed_diff_post"
global fe3="i.district i.year nilf_diff_post"
global fe4="i.district i.year migrated_diff_post"
global fe5="i.district i.year paid_diff_post"
global fe6="i.district i.year unpaid_diff_post"
global fe7="i.district i.year selfemp_diff_post"
global controls="age lessprimary primary secondary university schooling rural top5_tariff i.district i.year employed_diff_post"

global se = "robust cluster(district)"
global wt ="[aw=perwt]"
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"


********************************************
* TABLE 1 Panel A: SUMMARY STATISTICS
********************************************
keep if employed_diff_post!=.
format schooling lessprimary primary secondary university rural married employed unemployed nilf paid unpaid selfemp %9.2f
bys female: eststo: quietly estpost summarize schooling lessprimary primary secondary university rural married  ///
		employed unemployed nilf paid unpaid selfemp, listwise
esttab, cells("mean sd") label nodepvar

estpost ttest schooling lessprimary primary secondary university rural married employed unemployed nilf paid unpaid selfemp, by(female)

**********************************************************
* TABLE 2: TRADE LIBERALIZATION AND LABOR MARKET OUTCOMES 
**********************************************************
**Panel A: Employment Status Outcomes
**I - Men
eststo clear
	reg employed district_tariff $fe1 $xvar1 $wt if female==0, $se 
	eststo l1
	reg unemployed district_tariff $fe2 $xvar1 $wt if female==0, $se 
	eststo l2
	reg nilf district_tariff $fe3 $xvar1 $wt if female==0, $se 
	eststo l3

estout l1 l2 l3 using "output/t2a.tex", ///
	replace style(tex) collabels(, none) label varlabels(district_tariff "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(district_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**II - Women
eststo clear
	reg employed district_tariff $fe1 $xvar1 $wt if female==1, $se 
	eststo l1
	reg unemployed district_tariff $fe2 $xvar1 $wt if female==1, $se 
	eststo l2
	reg nilf district_tariff $fe3 $xvar1 $wt if female==1, $se 
	eststo l3

estout l1 l2 l3 using "output/t2b.tex", ///
	replace style(tex) collabels(, none) label varlabels(district_tariff "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(district_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**III - Test of coefficient equality between women and men
reg employed district_tariff $fe1 $xvar1 $wt if female==0
est store r
reg employed district_tariff $fe1 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]district_tariff = [u_mean]district_tariff
outreg2 using "output/t2test_employed", excel replace ctitle(Test) keep(district_tariff) addstat(chi-square test, r(p)) adec(3) nonotes nocons

reg unemployed district_tariff $fe2 $xvar1 $wt if female==0
est store r
reg unemployed district_tariff $fe2 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]district_tariff = [u_mean]district_tariff
outreg2 using "output/t2test_unemployed", excel replace ctitle(Test) keep(district_tariff) addstat(chi-square test, r(p)) adec(3) nonotes nocons

reg nilf district_tariff $fe3 $xvar1 $wt if female==0
est store r
reg nilf district_tariff $fe3 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]district_tariff = [u_mean]district_tariff
outreg2 using "output/t2test_nilf", excel replace ctitle(Test) keep(district_tariff) addstat(chi-square test, r(p)) adec(3) nonotes nocons

**Panel B: Type of Employment Outcomes
**I - Men
eststo clear
	reg paid district_tariff $fe5 $xvar1 $wt if female==0, $se 
	eststo l1
	reg unpaid district_tariff $fe6 $xvar1 $wt if female==0, $se 
	eststo l2
	reg selfemp district_tariff $fe7 $xvar1 $wt if female==0, $se 
	eststo l3

estout l1 l2 l3 using "output/t2c.tex", ///
	replace style(tex) collabels(, none) label varlabels(district_tariff "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(district_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**II - Women
eststo clear
	reg paid district_tariff $fe5 $xvar1 $wt if female==1, $se 
	eststo l1
	reg unpaid district_tariff $fe6 $xvar1 $wt if female==1, $se 
	eststo l2
	reg selfemp district_tariff $fe7 $xvar1 $wt if female==1, $se 
	eststo l3

estout l1 l2 l3 using "output/t2d.tex", ///
	replace style(tex) collabels(, none) label varlabels(district_tariff "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(district_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**III - Test of coefficient equality between women and men
reg paid district_tariff $fe5 $xvar1 $wt if female==0
est store r
reg paid district_tariff $fe5 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]district_tariff = [u_mean]district_tariff
outreg2 using "output/t2test_paid", excel replace ctitle(Test) keep(district_tariff) addstat(chi-square test, r(p)) adec(3) nonotes nocons

reg unpaid district_tariff $fe6 $xvar1 $wt if female==0
est store r
reg unpaid district_tariff $fe6 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]district_tariff = [u_mean]district_tariff
outreg2 using "output/t2test_unpaid", excel replace ctitle(Test) keep(district_tariff) addstat(chi-square test, r(p)) adec(3) nonotes nocons

reg selfemp district_tariff $fe7 $xvar1 $wt if female==0
est store r
reg selfemp district_tariff $fe7 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]district_tariff = [u_mean]district_tariff
outreg2 using "output/t2test_selfemp", excel replace ctitle(Test) keep(district_tariff) addstat(chi-square test, r(p)) adec(3) nonotes nocons

************************************************
* TABLE A7: TRADE LIBERALIZATION AND  MIGRATION  
************************************************
**Panel A: Migration Outcomes
eststo clear
	reg migrated district_tariff $fe4 $xvar1 $wt, $se 
	eststo l1
	reg migrated district_tariff $fe4 $xvar1 $wt if female==0, $se 
	eststo l2
	reg migrated district_tariff $fe4 $xvar1 $wt if female==1, $se 
	eststo l3

estout l1 l2 l3 using "output/tA7a.tex", ///
	replace style(tex) collabels(, none) label varlabels(district_tariff "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(district_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**Panel B: Migration Outcomes by Education
eststo clear
	reg migrated tariff_lesseducated district_tariff lesseducated $fe4 $xvar1 $wt, $se
	eststo l1
	reg migrated tariff_lesseducated district_tariff lesseducated $fe4 $xvar1 $wt if female==0, $se
	eststo l2
	reg migrated tariff_lesseducated district_tariff lesseducated $fe4 $xvar1 $wt if female==1, $se
	eststo l3

estout l1 l2 l3 using "output/tA7b.tex", ///
	replace style(tex) collabels(, none) label varlabels(tariff_lesseducated "District tariff $\times$ Lower education" district_tariff "District tariff")  ///
	cells(b(star fmt(%9.3f)) se(par))  keep(tariff_lesseducated district_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**Panel C: Migration Outcomes by Age
eststo clear
	reg migrated tariff_younger district_tariff younger30 $fe4 $xvar1 $wt , $se
	eststo l1
	reg migrated tariff_younger district_tariff younger30 $fe4 $xvar1 $wt if female==0, $se
	eststo l2
	reg migrated tariff_younger district_tariff younger30 $fe4 $xvar1 $wt if female==1, $se
	eststo l3
	
estout l1 l2 l3 using "output/tA7c.tex", ///
	replace style(tex) collabels(, none) label varlabels(tariff_younger "District tariff $\times$ Younger" district_tariff "District tariff")  ///
	cells(b(star fmt(%9.3f)) se(par))  keep(tariff_younger district_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 
	
**********************************************************
* TABLE A8: TRADE LIBERALIZATION AND LABOR MARKET OUTCOMES USING THE LOG DISTRICT TARIFF
**********************************************************
gen log_district_tariff=ln(district_tariff)
label var log_district_tariff "Log district tariff"
**I - Men
eststo clear
	reg employed log_district_tariff $fe1 $xvar1 $wt if female==0, $se 
	eststo l1
	reg unemployed log_district_tariff $fe2 $xvar1 $wt if female==0, $se 
	eststo l2
	reg nilf log_district_tariff $fe3 $xvar1 $wt if female==0, $se 
	eststo l3

estout l1 l2 l3 using "output/tA8a.tex", ///
	replace style(tex) collabels(, none) label varlabels(log_district_tariff "Log district tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(log_district_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**II - Women
eststo clear
	reg employed log_district_tariff $fe1 $xvar1 $wt if female==1, $se 
	eststo l1
	reg unemployed log_district_tariff $fe2 $xvar1 $wt if female==1, $se 
	eststo l2
	reg nilf log_district_tariff $fe3 $xvar1 $wt if female==1, $se 
	eststo l3

estout l1 l2 l3 using "output/tA8b.tex", ///
	replace style(tex) collabels(, none) label varlabels(log_district_tariff "Log district tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(log_district_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**III - Test of coefficient equality between women and men
reg employed log_district_tariff $fe1 $xvar1 $wt if female==0
est store r
reg employed log_district_tariff $fe1 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]log_district_tariff = [u_mean]log_district_tariff
outreg2 using "output/tA8test_employed", excel replace ctitle(Test) keep(log_district_tariff) addstat(chi-square test, r(p)) adec(3) nonotes nocons

reg unemployed log_district_tariff $fe2 $xvar1 $wt if female==0
est store r
reg unemployed log_district_tariff $fe2 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]log_district_tariff = [u_mean]log_district_tariff
outreg2 using "output/tA8test_unemployed", excel replace ctitle(Test) keep(log_district_tariff) addstat(chi-square test, r(p)) adec(3) nonotes nocons

reg nilf log_district_tariff $fe3 $xvar1 $wt if female==0
est store r
reg nilf log_district_tariff $fe3 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]log_district_tariff = [u_mean]log_district_tariff
outreg2 using "output/tA8test_nilf", excel replace ctitle(Test) keep(log_district_tariff) addstat(chi-square test, r(p)) adec(3) nonotes nocons

**I - Men
eststo clear
	reg paid log_district_tariff $fe5 $xvar1 $wt if female==0, $se 
	eststo l1
	reg unpaid log_district_tariff $fe6 $xvar1 $wt if female==0, $se 
	eststo l2
	reg selfemp log_district_tariff $fe7 $xvar1 $wt if female==0, $se 
	eststo l3

estout l1 l2 l3 using "output/tA8c.tex", ///
	replace style(tex) collabels(, none) label varlabels(log_district_tariff "Log district tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(log_district_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**II - Women
eststo clear
	reg paid log_district_tariff $fe5 $xvar1 $wt if female==1, $se 
	eststo l1
	reg unpaid log_district_tariff $fe6 $xvar1 $wt if female==1, $se 
	eststo l2
	reg selfemp log_district_tariff $fe7 $xvar1 $wt if female==1, $se 
	eststo l3

estout l1 l2 l3 using "output/tA8d.tex", ///
	replace style(tex) collabels(, none) label varlabels(log_district_tariff "Log district tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(log_district_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**III - Test of coefficient equality between women and men
reg paid log_district_tariff $fe5 $xvar1 $wt if female==0
est store r
reg paid log_district_tariff $fe5 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]log_district_tariff = [u_mean]log_district_tariff
outreg2 using "output/tA8test_paid", excel replace ctitle(Test) keep(log_district_tariff) addstat(chi-square test, r(p)) adec(3) nonotes nocons

reg unpaid log_district_tariff $fe6 $xvar1 $wt if female==0
est store r
reg unpaid log_district_tariff $fe6 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]log_district_tariff = [u_mean]log_district_tariff
outreg2 using "output/tA8test_unpaid", excel replace ctitle(Test) keep(log_district_tariff) addstat(chi-square test, r(p)) adec(3) nonotes nocons

reg selfemp log_district_tariff $fe7 $xvar1 $wt if female==0
est store r
reg selfemp log_district_tariff $fe7 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]log_district_tariff = [u_mean]log_district_tariff
outreg2 using "output/tA8test_selfemp", excel replace ctitle(Test) keep(log_district_tariff) addstat(chi-square test, r(p)) adec(3) nonotes nocons

********************************************
* TABLE A11: TRADE LIBERALIZATION AND LABOR MARKET OUTCOMES USING A RECONSTRUCTED TARIFF MEASURE THAT EXCLUDES INDUSTRIES WITH HIGHEST TARIFF DECLINES
********************************************
**I - Men
eststo clear
	reg employed dist_tariff_exhigh $fe1 $xvar1 $wt if female==0, $se 
	eststo l1
	reg unemployed dist_tariff_exhigh $fe2 $xvar1 $wt if female==0, $se 
	eststo l2
	reg nilf dist_tariff_exhigh $fe3 $xvar1 $wt if female==0, $se 
	eststo l3

estout l1 l2 l3 using "output/tA11a.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_exhigh "District tariff alt.") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_exhigh) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**II - Women
eststo clear
	reg employed dist_tariff_exhigh $fe1 $xvar1 $wt if female==1, $se 
	eststo l1
	reg unemployed dist_tariff_exhigh $fe2 $xvar1 $wt if female==1, $se 
	eststo l2
	reg nilf dist_tariff_exhigh $fe3 $xvar1 $wt if female==1, $se 
	eststo l3

estout l1 l2 l3 using "output/tA11b.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_exhigh "District tariff alt.") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_exhigh) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**III - Test of coefficient equality between women and men
reg employed dist_tariff_exhigh $fe1 $xvar1 $wt if female==0
est store r
reg employed dist_tariff_exhigh $fe1 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]dist_tariff_exhigh = [u_mean]dist_tariff_exhigh
outreg2 using "output/tA11test_employed", excel replace ctitle(Test) keep(dist_tariff_exhigh) addstat(chi-square test, r(p)) adec(3) nonotes nocons

reg unemployed dist_tariff_exhigh $fe2 $xvar1 $wt if female==0
est store r
reg unemployed dist_tariff_exhigh $fe2 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]dist_tariff_exhigh = [u_mean]dist_tariff_exhigh
outreg2 using "output/tA11test_unemployed", excel replace ctitle(Test) keep(dist_tariff_exhigh) addstat(chi-square test, r(p)) adec(3) nonotes nocons

reg nilf dist_tariff_exhigh $fe3 $xvar1 $wt if female==0
est store r
reg nilf dist_tariff_exhigh $fe3 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]dist_tariff_exhigh = [u_mean]dist_tariff_exhigh
outreg2 using "output/tA11test_nilf", excel replace ctitle(Test) keep(dist_tariff_exhigh) addstat(chi-square test, r(p)) adec(3) nonotes nocons

**I - Men
eststo clear
	reg paid dist_tariff_exhigh $fe5 $xvar1 $wt if female==0, $se 
	eststo l1
	reg unpaid dist_tariff_exhigh $fe6 $xvar1 $wt if female==0, $se 
	eststo l2
	reg selfemp dist_tariff_exhigh $fe7 $xvar1 $wt if female==0, $se 
	eststo l3

estout l1 l2 l3 using "output/tA11c.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_exhigh "District tariff alt.") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_exhigh) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**II - Women
eststo clear
	reg paid dist_tariff_exhigh $fe5 $xvar1 $wt if female==1, $se 
	eststo l1
	reg unpaid dist_tariff_exhigh $fe6 $xvar1 $wt if female==1, $se 
	eststo l2
	reg selfemp dist_tariff_exhigh $fe7 $xvar1 $wt if female==1, $se 
	eststo l3

estout l1 l2 l3 using "output/tA11d.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_exhigh "District tariff alt.") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_exhigh) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**III - Test of coefficient equality between women and men
reg paid dist_tariff_exhigh $fe5 $xvar1 $wt if female==0
est store r
reg paid dist_tariff_exhigh $fe5 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]dist_tariff_exhigh = [u_mean]dist_tariff_exhigh
outreg2 using "output/tA11test_paid", excel replace ctitle(Test) keep(dist_tariff_exhigh) addstat(chi-square test, r(p)) adec(3) nonotes nocons

reg unpaid dist_tariff_exhigh $fe6 $xvar1 $wt if female==0
est store r
reg unpaid dist_tariff_exhigh $fe6 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]dist_tariff_exhigh = [u_mean]dist_tariff_exhigh
outreg2 using "output/tA11test_unpaid", excel replace ctitle(Test) keep(dist_tariff_exhigh) addstat(chi-square test, r(p)) adec(3) nonotes nocons

reg selfemp dist_tariff_exhigh $fe7 $xvar1 $wt if female==0
est store r
reg selfemp dist_tariff_exhigh $fe7 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]dist_tariff_exhigh = [u_mean]dist_tariff_exhigh
outreg2 using "output/tA11test_selfemp", excel replace ctitle(Test) keep(dist_tariff_exhigh) addstat(chi-square test, r(p)) adec(3) nonotes nocons

********************************************
* TABLE A14: TRADE LIBERALIZATION AND LABOR MARKET OUTCOMES USING A RECONSTRUCTED TARIFF MEASURE THAT EXCLUDES INDUSTRIES WITH LOWEST TARIFF DECLINES
********************************************
**I - Men
eststo clear
	reg employed dist_tariff_exlow $fe1 $xvar1 $wt if female==0, $se 
	eststo l1
	reg unemployed dist_tariff_exlow $fe2 $xvar1 $wt if female==0, $se 
	eststo l2
	reg nilf dist_tariff_exlow $fe3 $xvar1 $wt if female==0, $se 
	eststo l3

estout l1 l2 l3 using "output/tA14a.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_exlow "District tariff alt.") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_exlow) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**II - Women
eststo clear
	reg employed dist_tariff_exlow $fe1 $xvar1 $wt if female==1, $se 
	eststo l1
	reg unemployed dist_tariff_exlow $fe2 $xvar1 $wt if female==1, $se 
	eststo l2
	reg nilf dist_tariff_exlow $fe3 $xvar1 $wt if female==1, $se 
	eststo l3

estout l1 l2 l3 using "output/tA14b.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_exlow "District tariff alt.") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_exlow) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**III - Test of coefficient equality between women and men
reg employed dist_tariff_exlow $fe1 $xvar1 $wt if female==0
est store r
reg employed dist_tariff_exlow $fe1 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]dist_tariff_exlow = [u_mean]dist_tariff_exlow
outreg2 using "output/tA14test_employed", excel replace ctitle(Test) keep(dist_tariff_exlow) addstat(chi-square test, r(p)) adec(3) nonotes nocons

reg unemployed dist_tariff_exlow $fe2 $xvar1 $wt if female==0
est store r
reg unemployed dist_tariff_exlow $fe2 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]dist_tariff_exlow = [u_mean]dist_tariff_exlow
outreg2 using "output/tA14test_unemployed", excel replace ctitle(Test) keep(dist_tariff_exlow) addstat(chi-square test, r(p)) adec(3) nonotes nocons

reg nilf dist_tariff_exlow $fe3 $xvar1 $wt if female==0
est store r
reg nilf dist_tariff_exlow $fe3 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]dist_tariff_exlow = [u_mean]dist_tariff_exlow
outreg2 using "output/tA14test_nilf", excel replace ctitle(Test) keep(dist_tariff_exlow) addstat(chi-square test, r(p)) adec(3) nonotes nocons

**I - Men
eststo clear
	reg paid dist_tariff_exlow $fe5 $xvar1 $wt if female==0, $se 
	eststo l1
	reg unpaid dist_tariff_exlow $fe6 $xvar1 $wt if female==0, $se 
	eststo l2
	reg selfemp dist_tariff_exlow $fe7 $xvar1 $wt if female==0, $se 
	eststo l3

estout l1 l2 l3 using "output/tA14c.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_exlow "District tariff alt.") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_exlow) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**II - Women
eststo clear
	reg paid dist_tariff_exlow $fe5 $xvar1 $wt if female==1, $se 
	eststo l1
	reg unpaid dist_tariff_exlow $fe6 $xvar1 $wt if female==1, $se 
	eststo l2
	reg selfemp dist_tariff_exlow $fe7 $xvar1 $wt if female==1, $se 
	eststo l3

estout l1 l2 l3 using "output/tA14d.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_exlow "District tariff alt.") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_exlow) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl

**III - Test of coefficient equality between women and men
reg paid dist_tariff_exlow $fe5 $xvar1 $wt if female==0
est store r
reg paid dist_tariff_exlow $fe5 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]dist_tariff_exlow = [u_mean]dist_tariff_exlow
outreg2 using "output/tA14test_paid", excel replace ctitle(Test) keep(dist_tariff_exlow) addstat(chi-square test, r(p)) adec(3) nonotes nocons

reg unpaid dist_tariff_exlow $fe6 $xvar1 $wt if female==0
est store r
reg unpaid dist_tariff_exlow $fe6 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]dist_tariff_exlow = [u_mean]dist_tariff_exlow
outreg2 using "output/tA14test_unpaid", excel replace ctitle(Test) keep(dist_tariff_exlow) addstat(chi-square test, r(p)) adec(3) nonotes nocons

reg selfemp dist_tariff_exlow $fe7 $xvar1 $wt if female==0
est store r
reg selfemp dist_tariff_exlow $fe7 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]dist_tariff_exlow = [u_mean]dist_tariff_exlow
outreg2 using "output/tA14test_selfemp", excel replace ctitle(Test) keep(dist_tariff_exlow) addstat(chi-square test, r(p)) adec(3) nonotes nocons

**********************************************************
* TABLE A17: TRADE LIBERALIZATION AND LABOR MARKET OUTCOMES USING A RECONSTRUCTED TARIFF MEASURE THAT EXCLUDES OFF-DIAGONAL INDUSTRIES
**********************************************************
**I - Men
eststo clear
	reg employed dist_tariff_offdiag $fe1 $xvar1 $wt if female==0, $se 
	eststo l1
	reg unemployed dist_tariff_offdiag $fe2 $xvar1 $wt if female==0, $se 
	eststo l2
	reg nilf dist_tariff_offdiag $fe3 $xvar1 $wt if female==0, $se 
	eststo l3

estout l1 l2 l3 using "output/tA17a.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_offdiag "District tariff alt.") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_offdiag) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**II - Women
eststo clear
	reg employed dist_tariff_offdiag $fe1 $xvar1 $wt if female==1, $se 
	eststo l1
	reg unemployed dist_tariff_offdiag $fe2 $xvar1 $wt if female==1, $se 
	eststo l2
	reg nilf dist_tariff_offdiag $fe3 $xvar1 $wt if female==1, $se 
	eststo l3

estout l1 l2 l3 using "output/tA17b.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_offdiag "District tariff alt.") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_offdiag) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**III - Test of coefficient equality between women and men
reg employed dist_tariff_offdiag $fe1 $xvar1 $wt if female==0
est store r
reg employed dist_tariff_offdiag $fe1 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]dist_tariff_offdiag = [u_mean]dist_tariff_offdiag
outreg2 using "output/tA17test_employed", excel replace ctitle(Test) keep(dist_tariff_offdiag) addstat(chi-square test, r(p)) adec(3) nonotes nocons

reg unemployed dist_tariff_offdiag $fe2 $xvar1 $wt if female==0
est store r
reg unemployed dist_tariff_offdiag $fe2 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]dist_tariff_offdiag = [u_mean]dist_tariff_offdiag
outreg2 using "output/tA17test_unemployed", excel replace ctitle(Test) keep(dist_tariff_offdiag) addstat(chi-square test, r(p)) adec(3) nonotes nocons

reg nilf dist_tariff_offdiag $fe3 $xvar1 $wt if female==0
est store r
reg nilf dist_tariff_offdiag $fe3 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]dist_tariff_offdiag = [u_mean]dist_tariff_offdiag
outreg2 using "output/tA17test_nilf", excel replace ctitle(Test) keep(dist_tariff_offdiag) addstat(chi-square test, r(p)) adec(3) nonotes nocons

**I - Men
eststo clear
	reg paid dist_tariff_offdiag $fe5 $xvar1 $wt if female==0, $se 
	eststo l1
	reg unpaid dist_tariff_offdiag $fe6 $xvar1 $wt if female==0, $se 
	eststo l2
	reg selfemp dist_tariff_offdiag $fe7 $xvar1 $wt if female==0, $se 
	eststo l3

estout l1 l2 l3 using "output/tA17c.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_offdiag "District tariff alt.") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_offdiag) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**II - Women
eststo clear
	reg paid dist_tariff_offdiag $fe5 $xvar1 $wt if female==1, $se 
	eststo l1
	reg unpaid dist_tariff_offdiag $fe6 $xvar1 $wt if female==1, $se 
	eststo l2
	reg selfemp dist_tariff_offdiag $fe7 $xvar1 $wt if female==1, $se 
	eststo l3

estout l1 l2 l3 using "output/tA17d.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_offdiag "District tariff alt.") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_offdiag) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**III - Test of coefficient equality between women and men
reg paid dist_tariff_offdiag $fe5 $xvar1 $wt if female==0
est store r
reg paid dist_tariff_offdiag $fe5 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]dist_tariff_offdiag = [u_mean]dist_tariff_offdiag
outreg2 using "output/tA17test_paid", excel replace ctitle(Test) keep(dist_tariff_offdiag) addstat(chi-square test, r(p)) adec(3) nonotes nocons

reg unpaid dist_tariff_offdiag $fe6 $xvar1 $wt if female==0
est store r
reg unpaid dist_tariff_offdiag $fe6 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]dist_tariff_offdiag = [u_mean]dist_tariff_offdiag
outreg2 using "output/tA17test_unpaid", excel replace ctitle(Test) keep(dist_tariff_offdiag) addstat(chi-square test, r(p)) adec(3) nonotes nocons

reg selfemp dist_tariff_offdiag $fe7 $xvar1 $wt if female==0
est store r
reg selfemp dist_tariff_offdiag $fe7 $xvar1 $wt if female==1
est store u
suest r u, vce(cluster district)
test [r_mean]dist_tariff_offdiag = [u_mean]dist_tariff_offdiag
outreg2 using "output/tA17test_selfemp", excel replace ctitle(Test) keep(dist_tariff_offdiag) addstat(chi-square test, r(p)) adec(3) nonotes nocons


log close

